.NET Framework Class Library |
ConcurrentStack<(Of <(T>)>)..::.TryPopRange Method (array<T>[]()[]) |
ConcurrentStack<(Of <(T>)>) Class See Also Send Feedback |
Attempts to pop and return multiple objects from the top of the ConcurrentStack<(Of <(T>)>)
atomically.
Namespace:
System.Collections.Concurrent
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function TryPopRange ( _ items As T() _ ) As Integer |
C# |
---|
public int TryPopRange( T[] items ) |
Parameters
- items
- Type: array<
T
>[]()[]
The Array to which objects popped from the top of the ConcurrentStack<(Of <(T>)>) will be added.
Return Value
The number of objects successfully popped from the top of the ConcurrentStack<(Of <(T>)>) and inserted in items.Remarks
When popping multiple items, if there is little contention on the stack, using
TryPopRange can be more efficient than using TryPop(T%)
once per item to be removed. Nodes fill the items
with the first node to be popped at the startIndex, the second node to be popped
at startIndex + 1, and so on.
Exceptions
Exception | Condition |
---|---|
System..::.ArgumentNullException | items is a null argument (Nothing in Visual Basic). |